package yxk.report.hr.hspm;

import kd.bos.bill.AbstractMobBillPlugIn;
import kd.bos.bill.MobileBillShowParameter;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.ListSelectedRow;
import kd.bos.entity.filter.FilterCondition;
import kd.bos.entity.filter.FilterParameter;
import kd.bos.entity.filter.FilterValue;
import kd.bos.entity.filter.SimpleFilterRow;
import kd.bos.ext.form.container.MessageCarouselContainer;
import kd.bos.form.MobileFormShowParameter;
import kd.bos.form.ShowType;
import kd.bos.form.StyleCss;
import kd.bos.form.container.Container;
import kd.bos.form.control.Control;
import kd.bos.form.control.Image;
import kd.bos.form.control.Search;
import kd.bos.form.control.events.*;
import kd.bos.form.events.*;
import kd.bos.list.BillList;
import kd.bos.list.IMobileListView;
import kd.bos.list.ListCardView;
import kd.bos.list.MobileSearch;
import kd.bos.list.events.ListRowClickEvent;
import kd.bos.list.plugin.AbstractMobListPlugin;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.sdk.plugin.Plugin;

import java.util.ArrayList;
import java.util.EventObject;
import java.util.List;

import static kd.epm.eb.common.rule.edit.RuleJsConstant.logic;

/**
 * 考勤档案列表
 */
public class MobBillPersonPlugin extends AbstractMobListPlugin implements Plugin {

    @Override
    public void listRowClick(ListRowClickEvent evt) {
        evt.setCancel(true);
        ListSelectedRow row = evt.getCurrentListSelectedRow();
        MobileFormShowParameter showParameter=new MobileFormShowParameter();
        showParameter.getOpenStyle().setShowType(ShowType.Floating);
        DynamicObject single = BusinessDataServiceHelper.loadSingleFromCache(row.getPrimaryKeyValue(), "hspm_ermanfile");
        String person = single.getString("person.id");
        showParameter.setCustomParam("person",person );
        showParameter.setCustomParam("userermanfilelist","人员档案列表");
        showParameter.setFormId("hspm_moberhome");
        showParameter.setHasRight(true);
        this.getView().showForm(showParameter);
    }

    @Override
    public void setFilter(SetFilterEvent e) {
         QFilter qFilter=new QFilter("iscurrentversion", QCP.equals,'1')
                .and(new QFilter("datastatus", QCP.equals,'1'))
                .and(new QFilter("businessstatus", QCP.equals,'1'))
                 .and(new QFilter("empposrel.isprimary",QCP.equals,'1'));
        List<QFilter> list=new ArrayList<>();
        list.add(qFilter);
        e.setCustomQFilters(list);
    }
}